package com.xiye.system.config;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 西野
 * @version V1.0
 * @title MyBatisMapperScannerConfig.java
 * @package com.xiye.system.config
 * @description MyBatis扫描接口
 * @date 2018-06-11
 */
@Configuration
//TODO 注意，因为MapperScannerConfigurer运行的比較早。所以必须有以下的注解
@AutoConfigureAfter(MyBatisConfig.class)
public class MyBatisMapperScannerConfig {

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
        mapperScannerConfigurer.setBasePackage("com.xiye.system.service.*.Service");
        return mapperScannerConfigurer;
    }

}
